#ifndef DOF_H
#define DOF_H

namespace DOF
{
	typedef unsigned int ID;

	class GameObject
	{
	public:
		GameObject(ID id, Ogre::Vector3 pos, Ogre::Quaternion rot, Ogre::String name = "")
			: m_ID(id), m_Name(name), m_Type("GameObject") {};

		virtual ~GameObject() {};
		virtual void update(const Ogre::FrameEvent &evt) {};

		//Getter
		ID getID(void) const { return m_ID; }
		Ogre::String getName(void) const { return m_Name; }
		Ogre::String getType(void) const { return m_Type; }

	private:
		ID m_ID;
		Ogre::String m_Name;
		Ogre::String m_Type;
	};

	typedef std::map<ID, GameObject*> GameObjectMap;

	class GameObjectManager : public Ogre::Singleton<GameObjectManager>
	{
	public:
		GameObjectManager() {};
		~GameObjectManager() {};

		template<typename T> GameObject *createObject(Ogre::Vector3 pos, Ogre::Quaternion rot, Ogre::String name = "");
		void update(const Ogre::FrameEvent &evt);
		bool destroyObject(ID id);

		void destroyAll(void);

		//Getter
		GameObject *getObjectByID(ID id) const;
		GameObject *getObjectByName(Ogre::String name);

	private:
		GameObjectManager(const GameObjectManager&);
		GameObjectManager& operator= (const GameObjectManager&);

		GameObjectMap m_GameObjectList;
	};
}

#endif

